﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbGripOverrule : OdRxOverrule
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbGripOverrule(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbGripOverrule_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbGripOverrule obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbGripOverrule()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbGripOverrule(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdDbGripOverrule() : this(TD_DbPINVOKE.new_OdDbGripOverrule(), MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
		{
			MemoryTransaction currentTransaction = MemoryManager.GetMemoryManager().GetCurrentTransaction();
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdDbGripOverrule(this.swigCPtr.Handle, true));
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		public new static OdDbGripOverrule cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbGripOverrule_cast(OdRxObject.getCPtr(pObj));
			OdDbGripOverrule result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbGripOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbGripOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbGripOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbGripOverrule_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("isA", OdDbGripOverrule.swigMethodTypes1) ? TD_DbPINVOKE.OdDbGripOverrule_isASwigExplicitOdDbGripOverrule(this.swigCPtr) : TD_DbPINVOKE.OdDbGripOverrule_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("queryX", OdDbGripOverrule.swigMethodTypes0) ? TD_DbPINVOKE.OdDbGripOverrule_queryXSwigExplicitOdDbGripOverrule(this.swigCPtr, OdRxClass.getCPtr(protocolClass)) : TD_DbPINVOKE.OdDbGripOverrule_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbGripOverrule createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbGripOverrule_createObject();
			OdDbGripOverrule result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbGripOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbGripOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbGripOverrule)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getGripPoints(OdDbEntity pSubject, OdGePoint3dArray gripPoints)
		{
			OdResult result = (OdResult)(this.SwigDerivedClassHasMethod("getGripPoints", OdDbGripOverrule.swigMethodTypes3) ? TD_DbPINVOKE.OdDbGripOverrule_getGripPointsSwigExplicitOdDbGripOverrule__SWIG_0(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdGePoint3dArray.getCPtr(gripPoints)) : TD_DbPINVOKE.OdDbGripOverrule_getGripPoints__SWIG_0(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdGePoint3dArray.getCPtr(gripPoints)));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getGripPoints(OdDbEntity pSubject, OdDbGripDataPtrArray gripsData, double curViewUnitSize, int gripSize, OdGeVector3d curViewDir, int bitFlags)
		{
			OdResult result = (OdResult)(this.SwigDerivedClassHasMethod("getGripPoints", OdDbGripOverrule.swigMethodTypes4) ? TD_DbPINVOKE.OdDbGripOverrule_getGripPointsSwigExplicitOdDbGripOverrule__SWIG_1(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdDbGripDataPtrArray.getCPtr(gripsData), curViewUnitSize, gripSize, OdGeVector3d.getCPtr(curViewDir), bitFlags) : TD_DbPINVOKE.OdDbGripOverrule_getGripPoints__SWIG_1(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdDbGripDataPtrArray.getCPtr(gripsData), curViewUnitSize, gripSize, OdGeVector3d.getCPtr(curViewDir), bitFlags));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult moveGripPointsAt(OdDbEntity pSubject, OdIntArray indices, OdGeVector3d offset)
		{
			OdResult result = (OdResult)(this.SwigDerivedClassHasMethod("moveGripPointsAt", OdDbGripOverrule.swigMethodTypes5) ? TD_DbPINVOKE.OdDbGripOverrule_moveGripPointsAtSwigExplicitOdDbGripOverrule__SWIG_0(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdIntArray.getCPtr(indices).Handle, OdGeVector3d.getCPtr(offset)) : TD_DbPINVOKE.OdDbGripOverrule_moveGripPointsAt__SWIG_0(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdIntArray.getCPtr(indices).Handle, OdGeVector3d.getCPtr(offset)));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult moveGripPointsAt(OdDbEntity pSubject, OdDbVoidPtrArray grips, OdGeVector3d offset, int bitFlags)
		{
			OdResult result = (OdResult)(this.SwigDerivedClassHasMethod("moveGripPointsAt", OdDbGripOverrule.swigMethodTypes6) ? TD_DbPINVOKE.OdDbGripOverrule_moveGripPointsAtSwigExplicitOdDbGripOverrule__SWIG_1(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdDbVoidPtrArray.getCPtr(grips), OdGeVector3d.getCPtr(offset), bitFlags) : TD_DbPINVOKE.OdDbGripOverrule_moveGripPointsAt__SWIG_1(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdDbVoidPtrArray.getCPtr(grips), OdGeVector3d.getCPtr(offset), bitFlags));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getStretchPoints(OdDbEntity pSubject, OdGePoint3dArray stretchPoints)
		{
			OdResult result = (OdResult)(this.SwigDerivedClassHasMethod("getStretchPoints", OdDbGripOverrule.swigMethodTypes7) ? TD_DbPINVOKE.OdDbGripOverrule_getStretchPointsSwigExplicitOdDbGripOverrule(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdGePoint3dArray.getCPtr(stretchPoints)) : TD_DbPINVOKE.OdDbGripOverrule_getStretchPoints(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdGePoint3dArray.getCPtr(stretchPoints)));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult moveStretchPointsAt(OdDbEntity pSubject, OdIntArray indices, OdGeVector3d offset)
		{
			OdResult result = (OdResult)(this.SwigDerivedClassHasMethod("moveStretchPointsAt", OdDbGripOverrule.swigMethodTypes8) ? TD_DbPINVOKE.OdDbGripOverrule_moveStretchPointsAtSwigExplicitOdDbGripOverrule(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdIntArray.getCPtr(indices).Handle, OdGeVector3d.getCPtr(offset)) : TD_DbPINVOKE.OdDbGripOverrule_moveStretchPointsAt(this.swigCPtr, OdDbEntity.getCPtr(pSubject), OdIntArray.getCPtr(indices).Handle, OdGeVector3d.getCPtr(offset)));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void gripStatus(OdDbEntity pSubject, GripStat status)
		{
			if (this.SwigDerivedClassHasMethod("gripStatus", OdDbGripOverrule.swigMethodTypes9))
			{
				TD_DbPINVOKE.OdDbGripOverrule_gripStatusSwigExplicitOdDbGripOverrule(this.swigCPtr, OdDbEntity.getCPtr(pSubject), (int)status);
			}
			else
			{
				TD_DbPINVOKE.OdDbGripOverrule_gripStatus(this.swigCPtr, OdDbEntity.getCPtr(pSubject), (int)status);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("queryX", OdDbGripOverrule.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_0(this.SwigDirectorqueryX);
			}
			if (this.SwigDerivedClassHasMethod("isA", OdDbGripOverrule.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_1(this.SwigDirectorisA);
			}
			if (this.SwigDerivedClassHasMethod("isApplicable", OdDbGripOverrule.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_2(this.SwigDirectorisApplicable);
			}
			if (this.SwigDerivedClassHasMethod("getGripPoints", OdDbGripOverrule.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_3(this.SwigDirectorgetGripPoints__SWIG_0);
			}
			if (this.SwigDerivedClassHasMethod("getGripPoints", OdDbGripOverrule.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_4(this.SwigDirectorgetGripPoints__SWIG_1);
			}
			if (this.SwigDerivedClassHasMethod("moveGripPointsAt", OdDbGripOverrule.swigMethodTypes5))
			{
				this.swigDelegate5 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_5(this.SwigDirectormoveGripPointsAt__SWIG_0);
			}
			if (this.SwigDerivedClassHasMethod("moveGripPointsAt", OdDbGripOverrule.swigMethodTypes6))
			{
				this.swigDelegate6 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_6(this.SwigDirectormoveGripPointsAt__SWIG_1);
			}
			if (this.SwigDerivedClassHasMethod("getStretchPoints", OdDbGripOverrule.swigMethodTypes7))
			{
				this.swigDelegate7 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_7(this.SwigDirectorgetStretchPoints);
			}
			if (this.SwigDerivedClassHasMethod("moveStretchPointsAt", OdDbGripOverrule.swigMethodTypes8))
			{
				this.swigDelegate8 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_8(this.SwigDirectormoveStretchPointsAt);
			}
			if (this.SwigDerivedClassHasMethod("gripStatus", OdDbGripOverrule.swigMethodTypes9))
			{
				this.swigDelegate9 = new OdDbGripOverrule.SwigDelegateOdDbGripOverrule_9(this.SwigDirectorgripStatus);
			}
			TD_DbPINVOKE.OdDbGripOverrule_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4, this.swigDelegate5, this.swigDelegate6, this.swigDelegate7, this.swigDelegate8, this.swigDelegate9);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdDbGripOverrule));
		}

		private IntPtr SwigDirectorqueryX(IntPtr protocolClass)
		{
			return OdRxObject.getCPtr(this.queryX((OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(protocolClass, false))).Handle;
		}

		private IntPtr SwigDirectorisA()
		{
			return OdRxClass.getCPtr(this.isA()).Handle;
		}

		private bool SwigDirectorisApplicable(IntPtr pOverruledSubject)
		{
			return this.isApplicable(Teigha.Core.Helpers.odrxCreateObjectInternal(pOverruledSubject, false));
		}

		private int SwigDirectorgetGripPoints__SWIG_0(IntPtr pSubject, IntPtr gripPoints)
		{
			return (int)this.getGripPoints((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdGePoint3dArray(gripPoints, false));
		}

		private int SwigDirectorgetGripPoints__SWIG_1(IntPtr pSubject, IntPtr gripsData, double curViewUnitSize, int gripSize, IntPtr curViewDir, int bitFlags)
		{
			return (int)this.getGripPoints((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdDbGripDataPtrArray(gripsData, false), curViewUnitSize, gripSize, new OdGeVector3d(curViewDir, false), bitFlags);
		}

		private int SwigDirectormoveGripPointsAt__SWIG_0(IntPtr pSubject, IntPtr indices, IntPtr offset)
		{
			return (int)this.moveGripPointsAt((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdIntArray(indices, true), new OdGeVector3d(offset, false));
		}

		private int SwigDirectormoveGripPointsAt__SWIG_1(IntPtr pSubject, IntPtr grips, IntPtr offset, int bitFlags)
		{
			return (int)this.moveGripPointsAt((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdDbVoidPtrArray(grips, false), new OdGeVector3d(offset, false), bitFlags);
		}

		private int SwigDirectorgetStretchPoints(IntPtr pSubject, IntPtr stretchPoints)
		{
			return (int)this.getStretchPoints((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdGePoint3dArray(stretchPoints, false));
		}

		private int SwigDirectormoveStretchPointsAt(IntPtr pSubject, IntPtr indices, IntPtr offset)
		{
			return (int)this.moveStretchPointsAt((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), new OdIntArray(indices, true), new OdGeVector3d(offset, false));
		}

		private void SwigDirectorgripStatus(IntPtr pSubject, int status)
		{
			this.gripStatus((OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(pSubject, false), (GripStat)status);
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_0 swigDelegate0;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_1 swigDelegate1;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_2 swigDelegate2;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_3 swigDelegate3;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_4 swigDelegate4;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_5 swigDelegate5;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_6 swigDelegate6;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_7 swigDelegate7;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_8 swigDelegate8;

		private OdDbGripOverrule.SwigDelegateOdDbGripOverrule_9 swigDelegate9;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(OdRxClass)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[]
		{
			typeof(OdRxObject)
		};

		private static Type[] swigMethodTypes3 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(OdGePoint3dArray)
		};

		private static Type[] swigMethodTypes4 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(OdDbGripDataPtrArray),
			typeof(double),
			typeof(int),
			typeof(OdGeVector3d),
			typeof(int)
		};

		private static Type[] swigMethodTypes5 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(OdIntArray),
			typeof(OdGeVector3d)
		};

		private static Type[] swigMethodTypes6 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(OdDbVoidPtrArray),
			typeof(OdGeVector3d),
			typeof(int)
		};

		private static Type[] swigMethodTypes7 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(OdGePoint3dArray)
		};

		private static Type[] swigMethodTypes8 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(OdIntArray),
			typeof(OdGeVector3d)
		};

		private static Type[] swigMethodTypes9 = new Type[]
		{
			typeof(OdDbEntity),
			typeof(GripStat)
		};

		public delegate IntPtr SwigDelegateOdDbGripOverrule_0(IntPtr protocolClass);

		public delegate IntPtr SwigDelegateOdDbGripOverrule_1();

		public delegate bool SwigDelegateOdDbGripOverrule_2(IntPtr pOverruledSubject);

		public delegate int SwigDelegateOdDbGripOverrule_3(IntPtr pSubject, IntPtr gripPoints);

		public delegate int SwigDelegateOdDbGripOverrule_4(IntPtr pSubject, IntPtr gripsData, double curViewUnitSize, int gripSize, IntPtr curViewDir, int bitFlags);

		public delegate int SwigDelegateOdDbGripOverrule_5(IntPtr pSubject, IntPtr indices, IntPtr offset);

		public delegate int SwigDelegateOdDbGripOverrule_6(IntPtr pSubject, IntPtr grips, IntPtr offset, int bitFlags);

		public delegate int SwigDelegateOdDbGripOverrule_7(IntPtr pSubject, IntPtr stretchPoints);

		public delegate int SwigDelegateOdDbGripOverrule_8(IntPtr pSubject, IntPtr indices, IntPtr offset);

		public delegate void SwigDelegateOdDbGripOverrule_9(IntPtr pSubject, int status);
	}
}
